#include<bits/stdc++.h>
using namespace std;
int main()
{
    int r,c,s=0;
    scanf("%d%d",&r,&c);
    char board[r+1][c+1];
    for(int i=1;i<=r;i++)
    {
        for(int j=1;j<=c;j++)
        {
            scanf("%c",&board[i][j]);
        }
    }
    for(int i=1;i<=r;i++)
    {
        for(int j=1;j<=c;j++)
        {
            if(board[i][j]=='#')
            {
                if(board[i][j-1]!='#'&&board[i][j+1]!='#'&&board[i+1][j]!='#')
                {
                    if(i-1==1)
                    {
                        if(board[i-1][j]!='#')
                        {
                            s++;
                        }
                    }
                    else
                    {
                        s++;
                    }
                }
            }
        }
    }
    printf("%d",s);
    system("pause");
    return 0;
}